﻿using System.Web.UI;
using System.Web.UI.WebControls;

namespace CustomControlPractice
{
    public class StylishTextBox : TextBox
    {
        protected override void AddAttributesToRender(System.Web.UI.HtmlTextWriter writer)
        {
            base.AddAttributesToRender(writer);
        }

        public override void RenderBeginTag(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Style,string.Format("width:{0};height:{1}",Width,Height));
            writer.AddAttribute(HtmlTextWriterAttribute.Class,"DivStyle");
            writer.RenderBeginTag(HtmlTextWriterTag.Div);
            base.RenderBeginTag(writer);
        }

        public override void RenderEndTag(HtmlTextWriter writer)
        {
            writer.AddAttribute(HtmlTextWriterAttribute.Style, string.Format("width:{0};height:{1}", Width, Height));
            writer.RenderBeginTag(HtmlTextWriterTag.Input);
            writer.RenderEndTag();
            writer.RenderEndTag();
            base.RenderEndTag(writer);
            
        }
    }
}
